package com.bytecollege.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bytecollege.model.User;
import org.junit.jupiter.api.Test;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

import java.util.List;

/**
 * @ClassName: userMpperText
 * @Description:
 * @Author: Sun
 * @Date: 2022/10/20 9:20
 */

@SpringBootTest
@MapperScan("com.bytecollege.mapper")
public class userMapperText {
      @Autowired
    private UserMapper userMapper;
      @Autowired
      private ArticleCollectMapper collectMapper;
      @Autowired
      private CremarkMapper cremarkMapper;
     @Autowired
      FootmarkMapper footmarkMapper;


      @Test
      public void reg(){
          User user = new User();
          user.setUserName("谭捷");
          user.setUserPwd("11111");
          user.setUserBirthday("sfdfs");

          int insert = userMapper.insert(user);

          System.out.println(insert);
      }

      @Test
      public void findByName(){
          String userName = "谭捷";

          QueryWrapper<User> userQueryWrapper = new QueryWrapper<>();
          LambdaQueryWrapper<User> eq = userQueryWrapper.lambda().eq(User::getUserName, userName);
          List<User> user1 = userMapper.selectList(eq);
          for (User user : user1) {
              System.out.println(user);
          }
      }


    @Test
    public void login(){
        User user = new User();
        user.setUserName("谭捷");
        user.setUserPwd("11111");
        user.setUserBirthday("12341231");

        int insert = userMapper.insert(user);

        System.out.println(insert);
    }



    @Test
    public void FootList() {

    }

}
